home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 March / CMCD0305.ISO / Software / Shareware / Utilitare / emu / Emu8086_Setup_307c.exe / {app} / Samples / 3_sample.asm < prev    next >
Assembly Source File  |  2002-08-02  |  447b  |  39 lines

  1. #make_BIN#
  2.  
  3. ; Calculate the sum
  4. ; of elements in V1 array,
  5. ; store result in V2.
  6.  
  7. ; number of elements:
  8. MOV CX, 5 
  9.  
  10. ; AL will store the sum:
  11. MOV AL, 0
  12.  
  13. ; BX is an index:
  14. MOV BX, 0
  15.  
  16.  
  17. ; sum elements:
  18. next: ADD AL, V1[BX]
  19.  
  20. ; modify array for no
  21. ; specific reason:
  22. MOV V1[BX], BL
  23.  
  24. ; next byte:
  25. INC BX
  26.  
  27. ; loop until CX=0:
  28. LOOP next
  29.  
  30.  
  31. ; store result in v2:
  32. MOV V2, AL
  33.  
  34. HLT
  35.  
  36. ; variables:
  37. V1 DB 4, 3, 2, 1, 0
  38. V2 DB 0
  39.